package com.gilight.base.dao;

import com.gilight.base.dto.SysUserRoleDto;
import com.gilight.base.model.SysRole;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface SysRoleMapper {

    int deleteByPrimaryKey(Long id);

    int insert(SysRole record);

    int insertSelective(SysRole record);

    SysRole selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SysRole record);

    int updateByPrimaryKey(SysRole record);

    List<SysRole> selectByUserId(Long userId);
    SysRole  selectDefaultRoleByUserId(Long userId);

    List<SysRole> selectByRoleName(String roleName);

    List<SysRole> findList(Map<String, Object> map);

    int delUserRoleByRoleId(Long roleId);

    int delRolePermissionByRoleId(@Param("roleId")Long roleId,@Param("appKey") String appKey);
    int delRoleButtonPermissionByRoleId(@Param("roleId") Long roleId,@Param("ids") List<Long> ids,@Param("appKey") String appKey);
    List<Long> selectButtonPermissionIdByRoleId(@Param("roleId") Long roleId,@Param("menuId") Long menuId);

    int insertBatchRolePermission(@Param("roleId") Long roleId, @Param("permissionIdList") List<Long> permissionIdList,@Param("appKey") String appKey);

    List<Map<String, Object>> findAllPermission(@Param("roleId")Long roleId,@Param("appKey") String appKey);
    List<Map<String, Object>> findAllButtonPermission(Long roleId);

    List<Map<String, Object>> allPermission(@Param("appKey") String appKey);
    void assignRoleDataRule(Map<String, Object> params);

    String getAppKeyByMenuId(@Param("menuId") Long menuId);

    List<Map<String, Object>> getUserListByRoleId(Map<String,Object> map);

    void deleteSysUserRoleData(@Param("roleId")Long roleId);

    void addUserRoleBatch(Map<String, Object> mapParam);

    void deleteUserRole(@Param("roleId")Long roleId, @Param("userId")Long userId);
}
